//
//  UIView+TXKit.h
//  TXKit
//
//  Created by YM on 2017/5/16.
//  Copyright © 2017年 Tincent. All rights reserved.
//
//  快速方式创建视图
//

#import <UIKit/UIKit.h>

@interface UIView (TXKit)

/**
 *  Create an UILabel with the given parameters
 *
 *  @param text      Label's text
 *  @param font      Label's font
 *  @param color     Label's text color
 *  @param align     Label's text alignment
 *  @param lines     Label's text lines
 *
 *  @return Return the created label
 */
+ (UILabel *)labelText:(NSString *)text
                  font:(UIFont *)font
                 color:(UIColor *)color
                 align:(NSTextAlignment )align
                 lines:(NSInteger )lines;


/**
 *  Create an UIButton with title
 *
 *  @param title     Button's title
 *  @param font      Button's font
 *  @param color     Button's text color
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)buttonWithTitle:(NSString *)title
                         font:(UIFont *)font
                        color:(UIColor *)color;

/**
 *  Create an UIButton with title and image
 *
 *  @param title     Button's title
 *  @param font      Button's font
 *  @param color     Button's text color
 *  @param image     Button's image
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)buttonWithTitle:(NSString *)title
                         font:(UIFont *)font
                        color:(UIColor *)color
                        image:(UIImage *)image;

/**
 *  Create an UIButton with title and background image
 *
 *  @param title         Button's title
 *  @param font          Button's font
 *  @param color         Button's text normal color
 *  @param hlColor       Button's text highlighted color
 *  @param seltColor     Button's text selected color
 *  @param disColor      Button's text disabled color
 *  @param bgImage       Button's bg normal image
 *  @param hlBgImage     Button's highlighted bg image
 *  @param seltImage     Button's selected bg image
 *  @param disImage      Button's disabled bg image
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)buttonWithTitle:(NSString *)title
                         font:(UIFont *)font
                        color:(UIColor *)color
                      hlColor:(UIColor *)hlColor
                    seltColor:(UIColor *)seltColor
                     disColor:(UIColor *)disColor
                      bgImage:(UIImage *)bgImage
                    hlBgImage:(UIImage *)hlBgImage
                    seltImage:(UIImage *)seltImage
                     disImage:(UIImage *)disImage;

/**
 *  Create an UIButton with title and background color
 *
 *  @param title         Button's title
 *  @param font          Button's font
 *  @param color         Button's text color
 *  @param hlColor       Button's text highlighted color
 *  @param seltColor     Button's text selected color
 *  @param bgColor       Button's bg color
 *  @param hlBgColor     Button's highlighted bg color
 *  @param seltBgColor   Button's disabled selected bg color
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)butonWithTitle:(NSString *)title
                        font:(UIFont *)font
                       color:(UIColor *)color
                     hlColor:(UIColor *)hlColor
                   seltColor:(UIColor *)seltColor
                     bgColor:(UIColor *)bgColor
                   hlBgColor:(UIColor *)hlBgColor
                 seltBgColor:(UIColor *)seltBgColor;

/**
 *  Create an UIButton with title and background color
 *
 *  @param title         Button's title
 *  @param font          Button's font
 *  @param color         Button's text color
 *  @param hlColor       Button's text highlighted color
 *  @param disColor      Button's text disabled color
 *  @param bgColor       Button's bg color
 *  @param hlBgColor     Button's highlighted bg color
 *  @param disBgColor    Button's disabled bg color
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)butonWithTitle:(NSString *)title
                        font:(UIFont *)font
                       color:(UIColor *)color
                     hlColor:(UIColor *)hlColor
                    disColor:(UIColor *)disColor
                     bgColor:(UIColor *)bgColor
                   hlBgColor:(UIColor *)hlBgColor
                  disBgColor:(UIColor *)disBgColor;

/**
 *  Create an UIButton with title and background color
 *
 *  @param title         Button's title
 *  @param font          Button's font
 *  @param color         Button's text color
 *  @param bgColor       Button's bg color
 *  @param hlBgColor     Button's highlighted bg color
 *  @param disBgColor    Button's disabled bg color
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)butonWithTitle:(NSString *)title
                        font:(UIFont *)font
                       color:(UIColor *)color
                     bgColor:(UIColor *)bgColor
                   hlBgColor:(UIColor *)hlBgColor
                  disBgColor:(UIColor *)disBgColor;

/**
 *  Create an UIButton with title and background color
 *
 *  @param title         Button's title
 *  @param font          Button's font
 *  @param color         Button's text color
 *  @param bgColor       Button's bg color
 *  @param hlBgColor     Button's highlighted bg color
 *
 *  @return Return the created UIButton
 */
+ (UIButton *)butonWithTitle:(NSString *)title
                        font:(UIFont *)font
                       color:(UIColor *)color
                     bgColor:(UIColor *)bgColor
                   hlBgColor:(UIColor *)hlBgColor;


/**
 *  Create an UIImageView with the given parameters
 *
 *  @param image                image
 *  @param contentMode          UIViewContentMode
 *
 *  @return Return the created UIImageView
 */
+ (UIImageView *)imageViewWithImage:(UIImage *)image
                               mode:(UIViewContentMode )contentMode;


/**
 *  Create an UITextField with the given parameters
 *
 *  @param placeholder                placeholder
 *  @param font                       UITextField's font
 *  @param color                      UITextField's text color
 *  @param delegate                   UITextFieldDelegate
 *
 *  @return Return the created UITextField
 */
+ (UITextField *)textFieldWithPlaceholder:(NSString *)placeholder
                                     font:(UIFont *)font
                                    color:(UIColor *)color
                                 delegate:(id<UITextFieldDelegate>)delegate;


/**
 *  Create an UIScrollView with the given parameters
 *
 *  @param pagingEnabled                pagingEnabled
 *  @param delegate                     UIScrollViewDelegate
 *
 *  @return Return the created UIScrollView
 */
+ (UIScrollView *)scrollViewWithPaging:(BOOL )pagingEnabled
                              delegate:(id<UIScrollViewDelegate>)delegate;


/**
 *  Create an UIScrollView with the given parameters
 *
 *  @param dataSource                UITableViewDataSource
 *  @param delegate                  UITableViewDelegate
 *
 *  @return Return the created UITableView
 */
+ (UITableView *)tableViewWithDataSource:(id<UITableViewDataSource>)dataSource
                                delegate:(id<UITableViewDelegate>)delegate;

/**
 *  Create an UIView with the given parameters
 *
 *  @return Return the created UIView
 */
+ (UIView *)aView;

/**
 *  Create an Split line view with default bg color
 * *
 *  @return Return the line
 */
+ (UIView *)splitLine;



/**
 *  set cornerRadius for view layer
 *
 *  @param radius                cornerRadius
 */
- (void)setLayerCorner:(CGFloat)radius;

/**
 *  set cornerRadius、borderWidth、borderColor for view layer
 *
 *  @param radius                cornerRadius
 *  @param width                 borderWidth
 *  @param color                 borderColor
 */
- (void)setLayerCorner:(CGFloat)radius
           borderWidth:(CGFloat )width
           borderColor:(UIColor *)color;

/**
 *  remove borders for view layer
 */
- (void)removeBorders;

/**
*  判断某个控件是否显示在主窗口
*/
- (BOOL)isShowingOnKeyWindow;

@end
